using UnityEngine;

public class BulletBase : MonoBehaviour
{
    public float speed = 10f; // 子弹的速度
    public float lifetime = 2f; // 子弹的生命周期
    private void Update()
    {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
        lifetime -= Time.deltaTime; // 更新计时器
        if (lifetime <= 0) Destroy(gameObject); // 时间小于0，销毁子弹
    }
}